Port miniserve to async#17
Open
willcrichton wants to merge 3 commits into
Open
Conversation
willcrichton
commented
Jul 30, 2024
| pub trait Handler: Fn(Request) -> Response + Send + Sync + 'static {} | ||
| pub trait Handler: Fn(Request) -> Self::Future + Send + Sync + 'static { | ||
| type Future: Future<Output = Response> + Send + Sync + 'static; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Take a close look at the change to the Handler trait. Previously, a handler was a function that took a request and returned a response. Now, a handler is a function that takes a request and returns a future which eventually returns a response.
willcrichton
force-pushed
the
01-async-await-a
branch
3 times, most recently
from
July 31, 2024 21:00
12e4e2b to
705d63d
Compare
willcrichton
force-pushed
the
00-chat-route-b
branch
from
July 31, 2024 21:00
bf3156c to
f4561fc
Compare
willcrichton
force-pushed
the
01-async-await-a
branch
from
August 26, 2024 20:54
473a30a to
eda5cdb
Compare
willcrichton
force-pushed
the
00-chat-route-b
branch
from
August 26, 2024 20:54
f4561fc to
43849b2
Compare
willcrichton
commented
Aug 26, 2024
| pub fn run(self) { | ||
| let listener = | ||
| TcpListener::bind("127.0.0.1:3000").expect("Failed to connect to 127.0.0.1:3000"); | ||
| pub async fn run(self) { |
Contributor
Author
There was a problem hiding this comment.
Note that the run function is now asynchronous, indicated by the async keyword.
willcrichton
force-pushed
the
01-async-await-a
branch
from
August 26, 2024 21:09
eda5cdb to
a1e8a88
Compare
willcrichton
force-pushed
the
00-chat-route-b
branch
from
August 26, 2024 21:22
43849b2 to
799f47d
Compare
willcrichton
force-pushed
the
01-async-await-a
branch
from
August 26, 2024 21:22
a1e8a88 to
1d89da8
Compare
willcrichton
force-pushed
the
01-async-await-a
branch
from
December 18, 2024 22:19
1d89da8 to
a5669b6
Compare
willcrichton
force-pushed
the
00-chat-route-b
branch
from
December 18, 2024 22:19
799f47d to
46170d7
Compare
willcrichton
force-pushed
the
00-chat-route-b
branch
from
April 23, 2025 22:10
46170d7 to
48c19c4
Compare
willcrichton
force-pushed
the
01-async-await-a
branch
2 times, most recently
from
April 23, 2025 22:13
33cee9f to
ddc5378
Compare
willcrichton
force-pushed
the
01-async-await-a
branch
from
June 20, 2025 20:33
ddc5378 to
ed6ea06
Compare
willcrichton
force-pushed
the
00-chat-route-b
branch
from
June 20, 2025 20:33
548d86e to
802a658
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change the
miniserveAPI to use Rust's async features via Tokio. Unfortunately, this breaks theservercrate, so CI is failing. Help me finish the port.